% rm_identical
% Christopher J. Whalen
% University of Illinois
% 10/19/04 - Date Created
% 10/19/04 - Last Modified

% Purpose - to remove identical coordinates from the sd_bananas


function [sd_banana] = rm_identical(sd_banana)







% Sort and Remove Identical Banana Voxels
%fprintf('Condensing Banana Data Set... \n');
%fprintf('  Estimated Time: 0-1 min\n');
sd_banana = round(sd_banana);
sd_banana = sortrows(sd_banana,[1 2 3]);
temp_sd_banana = zeros(size(sd_banana,1),size(sd_banana,2)); 
temp_row = 1;
tic;
for row=1:((size(sd_banana, 1))-1)
  if (sd_banana(row,1) == sd_banana(row+1,1)) & (sd_banana(row,2) == sd_banana(row+1,2)) & (sd_banana(row,3) == sd_banana(row+1,3))  
  else 
      temp_sd_banana(temp_row,:) = sd_banana(row, :);
      temp_row = temp_row + 1;
  end
end
temp_sd_banana(temp_row,:) = sd_banana((size(sd_banana, 1)),:);
temp_sd_banana((temp_row+1):length(sd_banana),:) = []; % Delete excess preallocated rows
rep_pts = size(sd_banana,1) - size(temp_sd_banana,1);
sd_banana = temp_sd_banana;
t_reduce_banana = toc;
%fprintf('  Actual Time: %-3.0f min\n', t_reduce_banana/60);
%fprintf('  Number of repeated points: %-3.0f\n', rep_pts);
%length(sd_banana)            
            


